using UnityEngine;

public class SceneGame_Enemy : MonoBehaviour
{
	
	private GameObject _Camera;
	
	public void Start()
	{
		_Camera = GameObject.Find("Camera");
	}
	
	public void Update()
	{
		float dz = _Camera.transform.position.z - transform.position.z;
		//if (dz >= 32.0f)
		//	Destroy(gameObject);
		//else
			renderer.enabled = dz > -2048 && dz < 32;
	}
	
	public void OnTriggerEnter(Collider collider)
	{
		if (collider.name == "PlayerPrefab")
			Destroy(gameObject);
	}
	
}